package cn.quevo.cube.provide.define.service.impl;

import cn.quevo.common.entity.PageResult;
import cn.quevo.cube.provide.define.dao.CubeModelDao;
import cn.quevo.cube.provide.define.entity.CubeModel;
import cn.quevo.cube.provide.define.entity.query.CubeModelQuery;
import cn.quevo.cube.provide.define.service.CubeModelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 模型 Service接口实现
 *
 * @author July july_sky@foxmail.com
 * @version 1.0
 * @date 2018/12/11 14:57:09
 * @Copyright 东方浩星（北京）传媒科技有限公司版权所有.All Rights Reserved.
 */
@Service("cubeModelService")
@Transactional(transactionManager="transactionManager",rollbackFor={Exception.class})
public class CubeModelServiceImpl implements CubeModelService {
    @Resource(name="cubeModelDao")
    private CubeModelDao cubeModelDao;

    @Override
    public Map<String,Object> getSinge(CubeModelQuery cubeModelQuery) {
        return this.cubeModelDao.getSinge(cubeModelQuery);
    }

    @Override
    public Integer create(CubeModel cubeModel) {
        cubeModel.validateCreate();
        return this.cubeModelDao.create(cubeModel);
    }

    @Override
    public Integer update(CubeModel cubeModel) {
        cubeModel.validateUpdate();
        return this.cubeModelDao.update(cubeModel);
    }

    @Override
    public PageResult<Map<String,Object>> getPage(CubeModelQuery cubeModelQuery) {
        return this.cubeModelDao.getPage(cubeModelQuery);
    }
}
